package it.polito.connectedcar.network;

public enum VehicleAttribute {

	SPEED(0),
	POSITION(1),
	ADD_VEHICLE_ADDRESS(2),
	REMOVE_VEHICLE_ADDRESS(3);
	
	private final int code;
	private VehicleAttribute(int code) {
		this.code = code;
	}
	
	public int getCode()
	{
		return this.code;
	}
	
	public static VehicleAttribute fromCode(int code)
	{
		for(VehicleAttribute va : VehicleAttribute.values())
		{
			if(va.getCode()==code)
				return va;
		}
		throw new IllegalArgumentException("no VehicleAttribute exists for the specified code");
	}
}
